The present invention relates to a data processing system and method and, more particularly, to a lazy messaging system and method.
A flexible message broker system may in response to a standard message content interface call be required to perform a merge operation in relation to an existing structured message (e.g. data base tuple) and a further or additional item of data or information. Conventionally, a message broker receives a message in the so-called wire-format, that is, as a string of binary ones and zeros. The process of merging a wire-format message with an additional item of data typically either comprises the steps of converting the message from a wire-format into, for example, a XML format message, performing the merge operation and converting the XML format message back into a wire-format message or processing the message in the wire-format by identifying where within the wire-format message the additional data could be incorporated, merging the additional data, also in a wire-format, into the wire-format message at the appropriate location within the wire-format message. The above process is clearly computationally expensive and represents a significant processing overhead within a messaging system. Such an overhead becomes less bearable in circumstances where there is a relatively high probability that the newly created merged message will not be utilised by another application or has a relatively limited life-time. There is a significant overhead in creating messages that become out of date relatively rapidly. Furthermore, a message may be created in anticipation of a request from a message broker which may never materialise.
It is an object of the present invention to mitigate at least some of the problems of the prior art.
Accordingly, a first aspect of the present invention provides a method for maintaining a data structure for a structured messaging system, the structured messaging system comprising an application capable of producing an output structured message in a prescribed format and capable of adding a received structured message to a data structure contained within a storage medium of the system; the method comprising the steps of
receiving a first structured message in a first format; the first structured message being associated with the output structured message in the prescribed format;
adding the first structured message in the first format to the data structure;
receiving a second structured message in a second format; the second structured message being associated with the output structured message in the prescribed format; and
adding the second structured message in the second format to the data structure such that the first and second structured messages are stored non-contiguously within the data structure. Preferably, additional information is added to the data structure for providing an association between the first and second structured messages
Preferably, an embodiment provides a method further comprising the step of constructing and outputting the output structured message in response to a query received by the application. It will be appreciated that producing the output message only when removes the need to process the first and second received structured message to render them in a format that complies with the prescribed format for the output message.
Preferably, an embodiment provides a method in which the step of producing comprises the step of forming the output structured message using derivations of the first and second structured messages to produce a physically contiguous output message. It will be appreciated by those skilled in the art that a calling application which requests the output message may use the output message for processing internal to that calling application or may, in turn, use the message to produce a further output message for a still further application.
It will be appreciated that in some instances, the output message may not require all data contained within either of the first and second messages. Suitably, an embodiment provides a method further comprising the step of selecting at least a portion of at least one of the first and second structured message to form part of the output structured message. In particular at the extreme, an application using the services of the embodiments of the present invention may often wish to retrieve the value of just a single field from a complex structured message; said complex structured message being the result of merging several structured messages input to the described system.
Often the prescribed format for an output message may not correspond to the message format in which the first or second message was received. Suitably, an embodiment provides a method in which the step of producing comprises translating at least a part of at least one of the first and second structured messages from a respective format to the prescribed format. Advantageously, the processing overhead of the prior associated with constructing the output message immediately upon of the first and second structured message or at least in advance of a request for or need to publish the output message in the prescribed format is removed.
An embodiment provides a method in which the step of outputting comprises the step of outputting the output structured message as non-contiguous portions derived from at least one of the first and second structured messages. It will be appreciated that such a lazy output of the output message has the advantage that the whole of the output message does not need to be formed in advance of servicing a request for the output message.
Accordingly, a second aspect of the present invention provides a data processing method for a data processing system comprising at least one application capable of outputting a message relating to first and second data contained within a data structure held within a memory of the data processing system; the method comprising the steps of storing the first and second data separately within data structure; and constructing a response to a query using the separately stored first and second data only in response to receiving such a query.
It will be appreciated that a query and hence a corresponding output message may require only a small fraction of the data contained within a structured message. Alternatively, the whole of the data contained within a stored message, in effect, the whole of a message, may be required in responding to a query. Accordingly, embodiments provide a method in which the step of constructing comprises the steps of collating at least a portion of the first data and at least a portion of the second data and converting said portions of the first and second data to a prescribed message format.
Still further embodiments provide a method in which the step of constructing further comprises the step of creating a message containing at least a portion of the first and second data.
Yet other embodiments may provide a method in which the step of constructing comprises the step of transmitting at least a portion of the first data to the at least one application and subsequently transmitting at least a portion the second data to the at least one application.
Advantageously, embodiments of the present invention by storing a message and any additional data intended to merged with the message in a fragmented form and only performing a merge operation in response to a query involving the stored message and the additional data avoid the processing overheads typically incurred in the prior art should such a query not be forthcoming. Therefore, the processing overheads of a message system or a flexible message broker can be significantly reduced.
A third aspect of the present invention provides a data processing system including at least one application capable of outputting a message relating to first and second data contained within a data structure held within a memory of the data processing system; the system comprising means for storing the first and second data separately within a data structure; and means for constructing a response to a query using the separately stored first and second data only in response to receiving such a query.
A fourth aspect of the present invention provides a computer program product for a data processing system comprising at least one application capable of outputting a message relating to first and second data contained within a data structure held within a memory of the data processing system; the computer program product comprising a storage medium having stored thereon computer program code means for storing the first and second data separately within data structure; and computer program code means for constructing a response to a query using the separately stored first and second data only in response to receiving such a query.